var express = require('express');
var router = express.Router();
var util = require('util');
var fs = require('node-fs');
var EventProxy = require('eventproxy');
var path = require('path');
var xlsx = require('node-xlsx');

var resultJson = require('../result-json');
var User = require('../models/User');
var resultJson = require('../result-json');
var Utils = require('../utils');
var logger = require('../models/logger');
var setting = require('../setting');

router.post("/upload", function(req, res, next) {
	Utils.upload(req, function(json) {
		res.send(json);
	});
});

router.post("/fanyi", function(req, res, next) {
	var from = req.body.from || "auto";
	var to = req.body.to || "auto";
	var content = req.body.content || "";
	Utils.fanyi(from, to, content, function(result) {
		console.log("result:"+result);
		res.send(resultJson(0, {"result":result}));
	});
});




router.get('/', function(req, res, next) {
	//res.redirect('./singup.html');
	res.redirect('./address.html');
});

module.exports = router;